//
//  TransformObject.h
//  CompGraf2
//
//  Created by Juan Niosi on 31/08/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>
#import <OpenGLES/ES2/gl.h>
#import <OpenGLES/ES2/glext.h>
#import "Engine.h"
#import "Vector3.h"

@interface TransformObject : NSObject
{
    NSString *name;
    GLfloat *position;
    GLfloat *rotation;
    GLfloat *scale;
    NSMutableArray *children;
    TransformObject *parent;
}
@property (nonatomic) GLfloat *position;
@property (nonatomic) GLfloat *rotation;
@property (nonatomic) GLfloat *scale;
@property (nonatomic, retain) NSMutableArray *children;
@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) TransformObject *parent;

- (void)applyTransform:(Engine *)engine;
- (void)resetTransform:(Engine *)engine;

- (void)translate:(GLfloat *)mov;
- (void)translateX:(GLfloat)mov;
- (void)translateY:(GLfloat)mov;
- (void)translateZ:(GLfloat)mov;

- (void)rotate:(GLfloat *)rot;
- (void)rotateX:(GLfloat)rot;
- (void)rotateY:(GLfloat)rot;
- (void)rotateZ:(GLfloat)rot;

- (void)scale:(GLfloat *)factors;
- (void)scaleBy:(GLfloat)factor;
- (void)scaleX:(GLfloat)x;
- (void)scaleY:(GLfloat)y;
- (void)scaleZ:(GLfloat)z;

- (GLfloat *)forward;

- (void)addChild:(TransformObject *)object;
- (TransformObject *)getChild:(NSString *)childName;
- (BOOL)removeChild:(NSString *)childName;

- (Vector3*)posToVec3;

- (GLfloat *)getWorldPosition:(GLfloat *)pos;

-(GLfloat)getDistance:(GLfloat *)from;
-(GLfloat)getSqrDistance:(GLfloat *)from;

@end
